package com.itheima;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
//找出下个月的倒数第3天是哪天
public class search_three {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        System.out.println("当前时间"+sdf.format(date));
        calendar.setTime(date);
        calendar.add(Calendar.MONTH,2);//月份+2
        calendar.set(Calendar.DAY_OF_MONTH, 1);//设置为当月的第一天
        calendar.add(Calendar.DAY_OF_MONTH, -3);//然后-3天

        Date time = calendar.getTime();

        System.out.println("下个月的第三天是"+time);
    }
}
